<template>
  <div class="box-wrap">
    <div v-if="showHead" class="head" :style="{ height: headHeight }">
      <div class="head-left">
        <span class="icon"></span>
        <span>{{ title }}</span>
      </div>
      <div class="head-right">
        <slot name="head"></slot>
      </div>
    </div>

    <div class="content" :class="noPadding ? 'no-padding' : 'padding'">
      <slot></slot>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'NstdBoxTitle',
    data() {
      return {};
    },
    props: {
      // 内容高度
      height: {
        type: String,
        default: '100%'
      },
      // 头部高度
      headHeight: {
        type: String,
        default: '36px'
      },
      // 头部标题
      title: {
        type: String,
        default: '标题'
      },
      // 是否需要头部
      showHead: {
        type: Boolean,
        default: true
      },
      noPadding: {
        type: Boolean,
        default: false
      }
    },
    watch: {},
    methods: {}
  };
</script>

<style lang="scss" scoped>
  .box-wrap {
    height: 100%;
    font-family:
      PingFangSC,
      PingFang SC;
    font-weight: 500;
    font-size: 18px;
    color: #ffffff;
    line-height: 25px;
    text-align: left;
    font-style: normal;
    border: 1px solid #127ca0;
    background: rgba(18, 124, 160, 0.25);
    display: flex;
    flex-direction: column;

    .head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      background: linear-gradient(90deg, #014baf 0%, #01122b 100%);
      border-bottom: 1px solid;
      border-image: linear-gradient(270deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.7)) 1 1;

      .head-left {
        display: flex;
        align-items: center;
        .icon {
          margin: 0 6px;
          display: inline-block;
          width: 5px;
          height: 23px;
          background: linear-gradient(360deg, #00e8ff 0%, #ffffff 100%);
          filter: blur(0.3333333333333333px);
        }
      }
      .head-right {
        margin-right: 10px;
        .right {
          padding: 0 4px;
          height: 26px;
          font-size: 14px;
          line-height: 24px;
          text-align: center;
          background: rgba(29, 212, 231, 0.1);
          box-shadow: inset 0px 0px 5px 3px #1dd4e7;
          border: 1px solid #1dd4e7;
          cursor: pointer;
          i {
            margin-left: 4px;
          }
        }
      }
    }
    .content {
      flex: 1;
      overflow: auto;
    }
    .padding {
      padding: 10px;
    }
    .no-padding {
      padding: 0px;
    }
  }
</style>
